<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"/>

    <title>我的市场（查看订单）</title>
    <link rel="stylesheet" href="../css/base.css"/>
    <link rel="stylesheet" href="../css/header.css"/>
    <style>
        html{
            background: #fff;
        }
        .main_content>.status{
            padding-left: 0.3rem;
            height: 0.8rem;
            line-height: 0.8rem;
            background-color: #fff;
            font-size: 0.36rem;
        }
        .main_content>.type{
            background-color: #fff;
            padding-bottom: 0.3rem;
            border-bottom: 0.2rem solid #eee;
            border-top: 0.2rem solid #eee;
        }
        .main_content>.type>p{
            position: relative;
            height: 1rem;
            line-height: 1rem;
            font-size: 0.3rem;
        }
        .type>p>em{
            position: absolute;
            left: 3%;
            font-size: 0.3rem;
        }
        .type>p>i{
            position: absolute;
            right: 3%;
            font-size: 0.3rem;
        }
        .type>h4{

            font-size: 0.24rem;
            padding: 0 0.3rem;
        }
        .type>h4>del{
            display: inline-block;
            width: 0.6rem;
            height: 0.8rem;
            background: url("../img/point%20(2).png") no-repeat center;
            -webkit-background-size: 100%;
            background-size: 100%;
            vertical-align: middle;
        }
        .product_goods_list{
            position: relative;
            width: 100%;
        }
        .product_goods{
            position: relative;
            width: 100%;
            background-color: #f4f4f4;
            padding: 0.3rem;
        }
        .product_goods>img{
            width: 1.8rem;
            min-height: 1.8rem;
            max-height: 1.8rem;
            vertical-align: middle;
        }
        .product_goods>.pro_middle{
            position: absolute;
            left: 2.4rem;
            top: 10%;
        }
        .product_goods>.pro_middle>span{
            overflow: hidden;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            word-break: break-all;
        }
        .product_goods>.pro_middle>.pro_type{
            margin-top: 0.3rem;
            position: relative;
        }
        .pro_middle>.pro_type>em{
            font-size: 0.36rem;
            color:#fe6430;
        }
        .pro_middle>.pro_type>i{
            position: absolute;
            right: 5%;
        }
        .pro_total_count{
            height: 0.86rem;
            line-height: 0.86rem;
            font-size: 0.24rem;
            color:#666;
            position: relative;
            background-color: #fff;
            border-bottom: 1px solid #eeeeee;
        }
        .pro_total_count>em{
            position: absolute;
            left: 3%;
        }
        .pro_total_count>i{
            position: absolute;
            right: 3%;
        }
        .refund{
            display: inline-block;
            float: right;
            margin-top: 0.2rem;
            padding:0.1rem 0.4rem;
            border:1px solid #eee;
            border-radius: 15px;
            margin-right: 0.3rem;
        }
        .buttons {
            position: fixed;
            bottom: 1%;
            right: 5%;
            height: 0.8rem;
           line-height: 0.8rem;
            padding:0 0.3rem;
        }
        .buttons button{
            padding:0.2rem 0.3rem;
            border-radius: 15px;
            background-color: #fff;
        }
        .see_order{
            border:1px solid #999 ;
            color:#999;
            margin-right: 0.3rem;
        }
        .receiving{
            color:#fcc283;
            border:1px solid #fcc283;
        }
    </style>
</head>
<body>
<div class="layer" style="overflow: hidden">
    <header>
        <i onclick="back()"></i>
        <h3>订单详情</h3>
    </header>

    <div class="main_content">
      <!--tianc-->
    </div>

</div>
</body>
<script src="../js/x_rem.js"></script>
<script src="../js/base.js"></script>
<script src="../js/jquery.js"></script>
<script src="../js/template-web.js"></script>
<script id="order" type="text/html">
    <p class="status">卖家已发货</p>
    <div class="type">
        <p class="clearfix"><em>收货人：{{receiveAddress.receiver}}</em> <i>{{receiveAddress.receiverPhone}}</i></p>
        <h4> <del></del>取货地址：{{receiveAddress.address}}</h4>
    </div>
    <div class="product_goods_list">
        <div class="product_goods">
            <img src="{{goods.images[0].path}}" alt=""/>
            <div class="pro_middle">
                <span>
                    {{goods.caption}}{{goods.introduction}}
                </span>
                <div class="pro_type">
                    <em>￥{{goods.smallPrice}}</em>
                    <i>X{{number}}</i>
                </div>
            </div>
        </div>
        <div class="pro_total_count">
            <em>邮费:￥{{goods.expressFee}}</em>
            <i> 总计{{number}}件</i>
        </div>
    </div>
   <!-- <div class="refund clearfix" >
        退款
    </div>-->

    <div class=" buttons clearfix">
        <button class="see_order" onclick="location.href='my_market_see_order.html?goodsOrderId={{goodsOrderId}}'">查看物流</button>
        <button class="receiving">确认收货</button>
    </div>
</script>
<script>
$(function(){
    var href=location.href.split("=")[1];
    render();
    function render(){
// /goods/findOneGoodsOrder goodsOrderId
        $.ajax({
            //处理session每次不唯一问题
            xhrFields: {
                withCredentials: true
            },
            async:false,
            type: "post",
            url: baseUrl+"/goods/findOneGoodsOrder",
            data:{
                goodsOrderId:href
            },
            dataType: 'json',
            success:function(data) {
                console.log(data);
                $(".main_content").html(template("order",data));

            }

        })
    }
    // /goods/checkGoods
    function checkGoods(){
        $.ajax({
            //处理session每次不唯一问题
            xhrFields: {
                withCredentials: true
            },
            async:false,
            type: "post",
            url: baseUrl+"/goods/checkGoods",
            data:{
                goodsOrderId:href
            },
            dataType: 'json',
            success:function(data) {
                console.log(data);
                if(data.code=="success"){
                    $(".receiving").text("已确认收货");
                    location.href="./my_market_order.html";
                }else{
                    alert("网络错误，请稍后重试");
                }
            }

        })
    }
    $(".receiving").click(function () {
        checkGoods();
    })
   /* $(".see_order").click(function(){
        see_order();
    })
    //查看物流
    function see_order(){
        $.ajax({
            //处理session每次不唯一问题
            xhrFields: {
                withCredentials: true
            },
            async:false,
            type: "post",
            url: baseUrl+"/goods/queryExpress",
            data:{
                goodsOrderId:href
            },
            dataType: 'json',
            success:function(data) {
                console.log(data);
                if(data.code=="success"||data.state==true||data.list!=="网络出了点小问题...."){

                }else{

                }

            }
        })
    }*/
})
</script>
</html>